import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SensorFuncVO, SensorFuncForm, SensorFuncQuery } from '@/api/hardware/sensorFunc/types';

/**
 * 查询传感器函数列表
 * @param query
 * @returns {*}
 */

export const listSensorFunc = (query?: SensorFuncQuery): AxiosPromise<SensorFuncVO[]> => {
  return request({
    url: '/hardware/sensorFunc/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询传感器函数详细
 * @param id
 */
export const getSensorFunc = (id: string | number): AxiosPromise<SensorFuncVO> => {
  return request({
    url: '/hardware/sensorFunc/' + id,
    method: 'get'
  });
};

/**
 * 新增传感器函数
 * @param data
 */
export const addSensorFunc = (data: SensorFuncForm) => {
  return request({
    url: '/hardware/sensorFunc',
    method: 'post',
    data: data
  });
};

/**
 * 修改传感器函数
 * @param data
 */
export const updateSensorFunc = (data: SensorFuncForm) => {
  return request({
    url: '/hardware/sensorFunc',
    method: 'put',
    data: data
  });
};

/**
 * 删除传感器函数
 * @param id
 */
export const delSensorFunc = (id: string | number | Array<string | number>) => {
  return request({
    url: '/hardware/sensorFunc/' + id,
    method: 'delete'
  });
};
